package com.msw.sentinel.rest;

import com.msw.sentinel.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author mashuangwei
 * @title: TestController
 * @projectName sentinel-demo
 * @description: TODO
 * @date 2019-08-29
 */
@RestController
@RefreshScope
public class TestController {

    @Value(value = "${useLocalCache:false}")
    private boolean useLocalCache;

    @Autowired
    private DemoService demoService;

    @GetMapping(value = "/get")
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }

    @GetMapping("/test")
    public String get( String str){
        return "hi " + str;
    }

    @GetMapping("/say")
    public String say(@RequestParam String content){
        return demoService.sayHi(content);
    }

}
